<script setup>
import { ref } from 'vue';

defineProps({
  msg: {
    type: String,
    required: true
  },
  address: String
})

const sex = ref('男')

// 自定义事件
const emits = defineEmits(['e-sex'])
const sendData = () => {
  // 触发事件，传递数据
  emits('e-sex', sex.value)
}

</script>

<template>
  <h1>{{ msg }}, {{ address }}</h1>
  <button @click="sendData">向父组件传递数据</button>
</template>

<style scoped>

</style>
